package factory.simple;

import factory.MengNiu;
import factory.Milk;
import factory.Telunsu;
import factory.Yili;

/**
 * @author wangkaiqiang
 * @title: SimpleFactory
 * @projectName DesignPattern
 * @description: 简单工厂模型
 * @date 2019/6/239:54
 */
public class SimpleFactory {

    public Milk getMilk(String name){
        if("特仑苏".equals(name)){
            return new Telunsu();
        }
        if("伊利".equals(name)){
            return new Yili();
        }
        if("蒙牛".equals(name)){
            return new MengNiu();
        }
        return null;
    }
}
